{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "1ede788b",
   "metadata": {},
   "source": [
    "1.导入rclpy和Node"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "2b0240ea",
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "import rclpy\n",
    "from rclpy.node import Node"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "586e8ab6",
   "metadata": {},
   "source": [
    "2.导入TF帧：TF帧对应的消息接口为geometry_msgs.msg下的TransformStamped\n",
    "其结构可以使用下面指令查看：\n",
    "\n",
    "```\n",
    "!ros2 interface show geometry_msgs/msg/TransformStamped\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "6a3feb9f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "# This expresses a transform from coordinate frame header.frame_id\r\n",
      "# to the coordinate frame child_frame_id at the time of header.stamp\r\n",
      "#\r\n",
      "# This message is mostly used by the\r\n",
      "# <a href=\"https://index.ros.org/p/tf2/\">tf2</a> package.\r\n",
      "# See its documentation for more information.\r\n",
      "#\r\n",
      "# The child_frame_id is necessary in addition to the frame_id\r\n",
      "# in the Header to communicate the full reference for the transform\r\n",
      "# in a self contained message.\r\n",
      "\r\n",
      "# The frame id in the header is used as the reference frame of this transform.\r\n",
      "std_msgs/Header header\r\n",
      "\r\n",
      "# The frame id of the child frame to which this transform points.\r\n",
      "string child_frame_id\r\n",
      "\r\n",
      "# Translation and rotation in 3-dimensions of child_frame_id from header.frame_id.\r\n",
      "Transform transform\r\n"
     ]
    }
   ],
   "source": [
    "!ros2 interface show geometry_msgs/msg/TransformStamped"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "69cefff7",
   "metadata": {},
   "outputs": [],
   "source": [
    "from geometry_msgs.msg import TransformStamped"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "de0410de",
   "metadata": {},
   "source": [
    "3.从tf2_ros包中导入静态坐标变换广播器"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "b3e88382",
   "metadata": {},
   "outputs": [],
   "source": [
    "from tf2_ros import StaticTransformBroadcaster"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "72808853",
   "metadata": {},
   "source": [
    "4.初始化节点"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "c1421620",
   "metadata": {},
   "outputs": [],
   "source": [
    "rclpy.init()\n",
    "node = Node(\"transform_node\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "400707c5",
   "metadata": {},
   "source": [
    "5.构造静态广播发布器"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "70636885",
   "metadata": {},
   "outputs": [],
   "source": [
    "static_tf_pub = StaticTransformBroadcaster(node)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2b0b9127",
   "metadata": {},
   "source": [
    "6.构造TF帧，，其要发布出去的消息"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "156e8419",
   "metadata": {},
   "outputs": [],
   "source": [
    "t = TransformStamped()\n",
    "t.header.stamp = node.get_clock().now().to_msg()\n",
    "# parent-name:基坐标系B\n",
    "t.header.frame_id = 'B'\n",
    "# chrild-name：相机坐标系C\n",
    "t.child_frame_id = 'C'\n",
    "# 平移关系，单位m\n",
    "t.transform.translation.x = 0.0\n",
    "t.transform.translation.y = 2.0\n",
    "t.transform.translation.z = 0.0\n",
    "# 旋转关系，四元数形式，我们需要将欧拉角的形式转换成四元数\n",
    "# 可以使用在线坐标转换工具：https://quaternions.online/\n",
    "t.transform.rotation.x = 0.0\n",
    "t.transform.rotation.y = 0.0\n",
    "t.transform.rotation.z = 0.0\n",
    "t.transform.rotation.w = 1.0"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "009c3752",
   "metadata": {},
   "source": [
    "7.发布坐标关系"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "117b1595",
   "metadata": {},
   "outputs": [],
   "source": [
    "static_tf_pub.sendTransform(t)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "21c24746",
   "metadata": {},
   "source": [
    "使用命令行监听坐标关系\n",
    "```\n",
    "ros2 run tf2_ros tf2_echo B C\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1fc3d36e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0m[INFO] [1637494815.010115433] [tf2_echo]: Waiting for transform B ->  C: Invalid frame ID \"B\" passed to canTransform argument target_frame - frame does not exist\u001b[0m\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n",
      "At time 0.0\n",
      "- Translation: [0.000, 2.000, 0.000]\n",
      "- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]\n"
     ]
    }
   ],
   "source": [
    "!ros2 run tf2_ros tf2_echo B C"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "73791fb0",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "23b94332",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6e3867b1",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cecaf09c",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2ead845d",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "celltoolbar": "原始单元格格式",
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
